﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Orderr
{
    [Serializable]
    public class Good
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int GoodID { get; set; }
        public string Name { get; set; }
        public int Price { get; set; }
//      public virtual List<OrderDetails> Details {get; set;}
        public Good(int ID, string nam, int pric)
        {
            GoodID = ID;  Name = nam; Price = pric;
        }
        public Good()
        {
        }
        public override string ToString()
        {
            return "单价为" + Price + "的" + Name;
        }
        public override int GetHashCode()
        {
            return Name.GetHashCode() + Price;
        }
        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            Good m = obj as Good;
            return GoodID == m.GoodID;
        }
    }
}